package com.tanhua.sso;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.ArrayList;
import java.util.List;

@SpringBootTest
@RunWith(SpringJUnit4ClassRunner.class)
public class test1111 {

    @Autowired
    private RedisTemplate<String,String> redisTemplate;
    @Test
    public void test23(){
        this.redisTemplate.opsForHash().put("222","333","345");
        this.redisTemplate.opsForHash().put("222","444","345");
        this.redisTemplate.opsForHash().put("222","555","345");

        System.out.println(this.redisTemplate.opsForHash().hasKey("222","235"));
        System.out.println(this.redisTemplate.opsForHash().keys("222").contains("333"));
    }

    @Test
    public void test(){
        List<Integer> list=new ArrayList<>();
        list.add(1);
        list.add(2);
        list.add(3);
        list.add(4);
        list.add(5);

        for (int i = 0; i < list.size(); i++) {
            if (1==list.get(i)){
                list.remove(i);
            }
        }

        System.out.println(list.get(0));
    }
}
